{template header}


{template sidebar}

<!-- artile begin -->
<div class="article">
{template title}

<!--{if  $type == 'outStock'}-->
<!--{if  $a == 'index' || $a == 'search_outStock'}-->
<form class="form-search" action="{$this->url($c, 'search_outStock', $this->get())}">
    <table>
        <tr><td class="td1" width="20%">出库单号：</td>
            <td>

                <div class="input-append">
                    <input type="text" name="key" class="span2 search-query" placeholder=""请输入出库单号 />
                    <button type="button" class="btn search">搜索</button>
                </div>
            </td >
        </tr>
    </table>

</form>
<!--{/if}-->

<!--{if  $a == 'lookGoods' || $a == 'search_Goods'}-->
<form class="form-search" action="{$this->url($c, 'search_Goods', array('type'=>G('type'),'inOutStockNo'=>G('inOutStockNo')))}">
    <table>
        <tr><td class="td1" width="20%">商品编号：</td>
            <td>

                <div class="input-append">
                    <input type="text" name="key" class="span2 search-query" placeholder="请输入商品编号" />
                    <button type="button" class="btn search">搜索</button>
                </div>
            </td >
        </tr>
    </table>

</form>
<!--{/if}-->
<table cellpadding="1" cellspacing="1" width="100%" border="0" accesskey="" >

    <!--{if  $a == 'index'|| $a == 'search_outStock'}-->

    <tr>
        <th width="10%">出库单号</th>
        <th width="10%">操作员</th>
        <th width="10%">出库日期</th>
        <th width="10%">商品品种数</th>
        <th width="15%">操作</th>
    </tr>

    <!--{if $result}-->
    <!--{loop $result $val}-->
    <tr>
        <td>{$val['inOutStockNo']}</td>
        <td>{$val['operator']}</td>
        <td>{$val['inOutStockDate']}</td>
        <td>{$val['amount']}</td>
        <td class="operate">
            <a href="{$this->url($c,'edit',array('inOutStockNo'=>$val['inOutStockNo'], 'type'=>'outStock'))}">编辑</a>
            <a title="删除商品" class="del" href="{$this->url($c,'del',array('inOutStockNo'=>$val['inOutStockNo']))}">删除</a>
        </td>
    </tr>

    <!--{/loop}-->

    <!--{else}-->
    <tr>

        <td colspan="5">没有数据记录文件！</td>

    </tr>
    <!--{/if}-->
    <tr>
        <td colspan="4" class="td4">
            <a title="添加供货商" class="btn btn-success " href="{$this->url($c,'addOrder',array('type' => $type))}">添加出库单</a>
        </td>
    </tr>
    <!--{/if}-->

    <!--{if  $a == 'lookGoods'|| $a == 'search_Goods'}-->
    <tr>

        <th width="20%">商品编号</th>
        <th width="20%">数量</th>
        <th width="20%">颜色信息</th>
        <th width="10%">尺码信息</th>
        <th width="15%">操作</th>
    </tr>
    <!--{if $result}-->
    <!--{loop $result $val}-->

    <tr>
        <td>{$val['goodsNo']}</td>
        <td>{$val['goodsNumber']}</td>
        <td>{$val['color']}</td>
        <td>{$val['size']}</td>
        <td class="operate">
            <a href="{$this->url($c,'editGoods',array('id'=>$val['id'], 'type'=>'outStock'))}">编辑</a>
            <a title="删除商品" class="del" href="{$this->url($c,'del',array('id'=>$val['id']))}">删除</a>
        </td>
    </tr>

    <!--{/loop}-->

    <!--{else}-->
    <tr>

        <td colspan="5">没有数据记录文件！</td>

    </tr>
    <!--{/if}-->

    <!--{/if}-->


</table>
<!--{/if}-->




<!--{if  $type == 'inStock'}-->
<!--{if  $a == 'index' || $a == 'search_inStock'}-->
<form class="form-search" action="{$this->url($c, 'search_inStock', $this->get())}">
    <table>
        <tr><td class="td1" width="20%">入库单号：</td>
            <td>

                <div class="input-append">
                    <input type="text" name="key" class="span2 search-query" placeholder="请输入旺旺ID" />
                    <button type="button" class="btn search">搜索</button>
                </div>
            </td >
        </tr>
    </table>

</form>
<!--{/if}-->
<!--{if  $a == 'lookGoods' || $a == 'search_Goods'}-->
<form class="form-search" action="{$this->url($c, 'search_Goods', array('type'=>G('type'),'inOutStockNo'=>G('inOutStockNo')))}">
    <table>
        <tr><td class="td1" width="20%">商品编号：</td>
            <td>

                <div class="input-append">
                    <input type="text" name="key" class="span2 search-query" placeholder="请输入商品编号" />
                    <button type="button" class="btn search">搜索</button>
                </div>
            </td >
        </tr>
    </table>

</form>
<!--{/if}-->

<table cellpadding="1" cellspacing="1" width="100%" border="0">
    <!--{if  $a == 'index' || $a == 'search_inStock'}-->
    <tr>
        <th width="10%">入库单号</th>
        <th width="10%">操作员</th>
        <th width="10%">入库日期</th>
        <th width="10%">商品品种总数</th>
        <th width="10%">供应商名称</th>
        <th width="15%">操作</th>

    </tr>

    <!--{if $result}-->
    <!--{loop $result $val}-->
    <tr>
        <td>{$val['inOutStockNo']}</td>
        <td>{$val['operator']}</td>
        <td>{$val['inOutStockDate']}</td>
        <td>{$val['amount']}</td>
        <td>{$val['supplierName']}</td>
        <td class="operate">
            <a href="{$this->url($c,'edit',array('inOutStockNo'=>$val['inOutStockNo'], 'type'=>'inStock'))}">编辑</a>
            <a title="删除商品" class="del" href="{$this->url($c,'del',array('inOutStockNo'=>$val['inOutStockNo']))}">删除</a>
        </td>
    </tr>
    <!--{/loop}-->
    <!--{else}-->
    <tr>
        <td colspan="5">没有数据记录！</td>
    </tr>
    <!--{/if}-->
    <tr>
        <td colspan="4" class="td4">
            <a title="添加供货商" class="btn btn-success " href="{$this->url($c,'addOrder',array('type' => $type))}">添加入库单</a>
        </td>
    </tr>
    <!--{/if}-->


    <!--{if  $a == 'lookGoods' || $a == 'search_Goods'}-->


    <tr>
        <td><input type="checkbox" name="id"  width="5%" value="{$t['Name']}" /></td>
        <th width="30%">商品编号</th>
        <th width="15%">数量</th>
        <th width="15%">颜色信息</th>
        <th width="15%" >尺码信息</th>
        <th width="20%">操作</th>
    </tr>



    <!--{if $result}-->
    <!--{loop $result $val}-->
    <tr>
        <td><input type="checkbox" name="id" width="5%" value="{$val['id']}" /></td>
        <td>{$val['goodsNo']}</td>
        <td>{$val['goodsNumber']}</td>
        <td>{$val['color']}</td>
        <td>{$val['size']}</td>
        <td class="operate">
            <a href="{$this->url($c,'editGoods',array('id'=>$val['id'], 'type'=>'inStock'))}">编辑</a>
            <a title="删除商品" class="del" href="{$this->url($c,'del',array('id'=>$val['id']))}">删除</a>
        </td>
    </tr>
    <!--{/loop}-->
    <!--{else}-->
    <tr>
        <td colspan="5">没有数据记录！</td>
    </tr>
    <!--{/if}-->

    <!--{/if}-->






</table>

<!--{/if}-->



<!--{if $a ==  'addGoods' ||  $a =='editGoods' }-->
<form method="post" action="{$this->url($c, 'saveGoods', array('id' => $result['id'],'type' => $type) )}">
    <table cellpadding="1" cellspacing="1" width="100%" border="0">
        <tr>
            <td class="td1">商品编号：</td>
            <td class="td2" colspan="4">
                <input type="text" name="goodsNo" value="{$a == 'editGoods'? $result['goodsNo']  : ''}" />
            </td>

        </tr>
        <tr>
            <td class="td1">入库类型：</td>
            <td class="td2" colspan="4">
                <select name="inStockType" >
                    <option value="1">新增入库</option>
                    <option value="2">换货入库</option>
                    <option value="3">补货入库</option>
                </select>
            </td>
        </tr>

        <tr>
            <td class="td1">货号：</td>
            <td class="td2" colspan="4">
                <input type="text" name="clothNo" value="{$a == 'editGoods'  ? $result['clothNo'] : ''} "/>
            </td>

        </tr>
        <tr>
            <td class="td1">数量：</td>
            <td class="td2" colspan="4">
                <input type="text" name="goodsNumber" value="{$a == 'editGoods'  ?$result['goodsNumber']   : ''}" />
            </td>
        </tr>


        <tr>
            <td class="td1">颜色：</td>
            <td class="td2" colspan="4">
                <!-- <input type="text" name="sort" placeholder="请输入供货商经营品类" value="{$a == 'edit' ? $result['sort'] : ''}" />  -->
                <!--{loop $this->color $k $v}-->
                <!--{if  $k % 6==0 }-->
                <br>
                <!--{/if}-->
                <input type="checkbox"  name="color[]" value="{$k}" {echo $k == $result['color'] ? 'checked':''} />{$v} &nbsp; &nbsp; &nbsp; &nbsp;
                <!--{/loop}-->

            </td>
        </tr>
        <tr>
            <td class="td1">尺码：</td>
            <td class="td2" colspan="4">
                <!-- <input type="text" name="sort" placeholder="请输入供货商经营品类" value="{$a == 'edit' ? $result['sort'] : ''}" />  -->
                <!--{loop $this->size $k $v}-->
                <!--{if  $k % 6==0 }-->
                <br>
                <!--{/if}-->
                <input type="checkbox" name="size[]" value="{$k}" {echo $k == $result['size'] ? 'checked':''}/>{$v} &nbsp; &nbsp;
                <!--{/loop}-->

            </td>


            <input type="hidden" name="inOutStockNo" value="{$result['inOutStockNo']}" />
            <input type="hidden" name="supplierName" value="{$result['supplierName']}" />

        </tr>
        <script type="text/javascript">
            $( function () {
                $( ":checkbox" ).click( function () {
                    var color_len = $( 'input[name="color[]"]:checked' ).length;
                    var size_len = $( 'input[name="size[]"]:checked' ).length;
                    //alert( "color:" + color_len + " size:" + size_len );
                    if ( color_len > 1 && size_len > 1 ) {
                        $.jBox.tip( "同一款衣服不能同时选择多个颜色和多个尺寸!" );
                        $( 'input[name="size[]"]' ).attr( 'checked', false ); // 让尺码全部成未选中
                        $( 'input[name="color[]"]' ).attr( 'checked', false ); // 让尺码全部成未选中
                        return false;
                    }
                });
            });
        </script>
        <tr>
            <td  colspan="2" class="td2">
                <a title="保存" class="btn btn-success save" href="{$this->url($c)}">保 存</a>
            </td>
            <td colspan="2" class="td2">
                <a title="重置" class="btn btn-success save" href="{$this->url($c)}">重 置</a>
            </td>
        </tr>
    </table>
</form>
<!--{/if}-->

<!--{if  $a == 'addOrder' ||  $a =='edit' }-->
<form method="post" action="{$this->url($c, 'save', array('inOutStockNo' => $result['inOutStockNo'],'type' => $type) )}">
    <table cellpadding="1" cellspacing="1" width="100%" border="0">


        <tr>
            <!--{if  $type == 'inStock'}-->
            <td class="td1">入库单号：</td>
            <!--{/if}-->
            <!--{if  $type == 'outStock'}-->
            <td class="td1">出库单号：</td>
            <!--{/if}-->

            <td class="td2" colspan="2">
                <input type="text" size="30" name="orderNo" value="{$a == 'edit' ? $result['inOutStockNo'] : ''}" />
            </td>
            <td class="operate">
                <a class="view" href="{$this->url($c,'addGoods',array('type'=>G('type')))}">添加商品</a>
                <a class="view" href="{$this->url($c,'lookGoods',array('type'=>G('type')))}">查看商品</a>
            </td>
            <script type="text/javascript">
                $(".view").click(function () {
                    var orderNo = $('input[name="orderNo"]').val();
                    var url = $(this).attr('href');
                    url = url + "&inOutStockNo=" + encodeURI(orderNo);
                    window.location = url;
                    return false;
                });
            </script>
        </tr>

        <!--{if  $type == 'inStock'}-->
        <tr>
            <td class="td1">供货商名称：</td>
            <td class="td2" colspan="4">
                <input type="text" name="supplierName" value="{$a == 'edit' ? $result['supplierName'] : ''}" />
            </td>
        </tr>
        <!--{/if}-->
        <tr>
            <td class="td1">商品总数：</td>
            <td class="td2" colspan="4">
                <input type="text" name="totalNum" value="{$a == 'edit' ? $result['amount'] : ''}" />
            </td>
        </tr>

        <tr>
            <th colspan="2" class="td4">
                <a title="保存供货商" class="btn btn-success save" href="{$this->url($c)}">保 存</a>
            </th>
        </tr>



    </table>
</form>
<!--{/if}-->








</div>
<!-- artile end -->
{template footer}